package auto;

import javax.swing.JOptionPane;

public class masb {


	public static String driverMySql = "com.mysql.jdbc.Driver";
	public static String mySqlString = "jdbc:mysql://www.energotech.rs/energot_mysql?user=energot_raf&password=java666cool";
	public static boolean admin = true;
	
	// *******************

	public static String decript(String text1) {

		if (text1.length() == 0)
			return "";
		String ulaz = text1;
		String izlaz = "";
		char c;
		byte b;
		byte bprethodni = 100;
		for (int i = 0; i <= ulaz.length() - 1; i++) {
			c = ulaz.charAt(i);
			b = (byte) c;
			b -= bprethodni;
			bprethodni = b;
			c = (char) b;
			izlaz += String.valueOf(c);
		}
		return izlaz;
	}

	public static String cript(String text1) {
		String ulaz = text1;
		String izlaz = "";
		char c;
		byte b;
		byte bprethodni = 100;
		byte bpom;
		for (int i = 0; i <= ulaz.length() - 1; i++) {
			c = ulaz.charAt(i);
			b = (byte) c;
			bpom = b;
			b += bprethodni;
			bprethodni = bpom;
			c = (char) b;
			izlaz += String.valueOf(c);
		}
		return izlaz;
	}

	public static String stringNull(Object txt) {
		if (txt == null)
			return "";
		else
			return txt.toString();
	}
	
	public static int intNull(Object txt){
		if (txt == null)
			return 0;
		else
			return Integer.parseInt(txt.toString());
	}
	
	public static int boolToInt (boolean txt){
		if (txt)
			return 1;
		return 0;
	}
	
	public static boolean comp (int i){
		if (i==0)
			return true;
		return false;
	}
	
	public static void msg(String txt) {
		JOptionPane.showMessageDialog(null, txt);
	}

	// *******************
}

